<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  // debounce防抖函数的学习和思考

  const refresh = debounce(this.$refs.scroll.refresh, 50)
  this.$bus.$on('itemImageLoad', () => {
    refresh()
  })

  export function debounce(func, delay) {
    let timer = null
    return function (...args) {
      if (timer) clearTimeout(timer)
      timer = setTimeout(() => {
        func.apply(this, args)
      }, delay)
    }
  }
/*
  涉及到的问题：
    1. refresh函数的包装和调用
    2. 闭包
    3. if的简写
    4. .apply()
    5. this的指向
    6. args参数的作用
*/

</script>
</body>
</html>